home *** CD-ROM | disk | FTP | other *** search
/ University of Minnesota Welcome Kit 2002 / PC Internet Tool.iso / pc / Installs / Script9x / Ppp.scp
Encoding:
Text File  |  1999-08-23  |  2.3 KB  |  122 lines

  1. ;
  2. ; This is a script file that demonstrates how
  3. ; to establish a ppp connection with a host.
  4. ;
  5. ; A script file must have a 'main' procedure.
  6. ; All script execution starts with this 'main'
  7. ; procedure.
  8. ;
  9.  
  10.  
  11. ; Main entry point to script
  12. ;
  13. proc main
  14.  
  15.    ; Change these variables to customize for your
  16.    ; specific Internet service provider.
  17.  
  18.    integer nTries = 3
  19.  
  20.    ; This is the login prompt and timeout values
  21.  
  22.    string szLogin = "sername:"
  23.    integer nLoginTimeout = 3
  24.  
  25.    ; This is the password prompt and timeout values
  26.  
  27.    string szPW = "assword:"
  28.    integer nPWTimeout = 3
  29.  
  30.    ; This is the prompt once your password is verified
  31.  
  32.    string szPrompt = "server>"
  33.  
  34.    ; This is the command to send to establish the 
  35.    ; connection.  This script assumes you only need
  36.    ; to issue one command to continue.  Feel free
  37.    ; to add more commands if your provider requires
  38.    ; it.
  39.  
  40.    string szConnect = "ppp default^M"
  41.  
  42.    ; Set this to FALSE if you don't want to get an IP
  43.    ; address
  44.  
  45.    boolean bUseSlip = FALSE
  46.  
  47.  
  48.    ; Delay for 2 seconds first to make sure the
  49.    ; host doesn't get confused when we send the
  50.    ; two carriage-returns.
  51.  
  52.    delay 2
  53.    transmit "^M^M"
  54.  
  55.    ; Attempt to login at most 'nTries' times
  56.  
  57.    while 0 < nTries do
  58.  
  59.       ; Wait for the login prompt before entering
  60.       ; the user ID, timeout after x seconds
  61.  
  62.       waitfor szLogin then DoLogin 
  63.         until nLoginTimeout
  64.  
  65. TryAgain:
  66.       transmit "^M"        ; ping
  67.       nTries = nTries - 1
  68.  
  69.    endwhile
  70.  
  71.    goto BailOut
  72.  
  73. DoLogin:
  74.    ; Enter user ID
  75.  
  76.    delay 2
  77.    transmit $USERID, raw
  78.    delay 2
  79.    transmit "^M"
  80.  
  81.    ; Wait for the password prompt 
  82.  
  83.    waitfor szPW until nPWTimeout
  84.    if FALSE == $SUCCESS then
  85.       goto TryAgain
  86.    endif
  87.  
  88.    ; Send the password
  89.  
  90.    transmit $PASSWORD, raw
  91.    transmit "^M"
  92.  
  93.    ; Wait for the prompt
  94.  
  95.    waitfor szPrompt
  96.  
  97.    transmit szConnect
  98.  
  99.    if bUseSlip then
  100.       ; An alternative to the following line is
  101.       ;
  102.       ;     waitfor "Your address is "
  103.       ;     set ipaddr getip
  104.       ;
  105.       ; if we don't know the order of the IP addresses.
  106.  
  107.       set ipaddr getip
  108.    endif
  109.  
  110.    goto Done
  111.  
  112. BailOut:
  113.    ; Something isn't responding.  Halt the script
  114.    ; and let the user handle it manually.
  115.  
  116.    set screen keyboard on
  117.    halt
  118.  
  119. Done:
  120.  
  121. endproc
  122.